Condition Statements Fundamentals

 

The following fundamentals relate to the creation of Condition Statements used in Conditional Documents, MaxConditions and MaxPlans. While the instructions below relate to variable and data from variables, the functions cannot be used for Document or Report Variables.

These functions are at the a much higher programming level than the Document or Report Variables. If a user needs the functionality of one of these functions, please check with the programmer to see if it can be written for use with Document or Report Variables.

Likewise Document and Report Variable functions should not be used with Condition Statement Expressions.

  Variable Types

The following is basic information about variable types that should be understood when creating the expressions within the condition statement.

  Strings

A string is a list of characters. The characters can be alphanumeric and contain spaces, line feeds and special characters.

For Example: ABC or 123 or ABC123.def/456

In CollectMax, most fields are strings including fields that may look like a numeric. The following is an example of some CollectMax string fields:

Status - '010'
Debtor Account Number - '2010000123'
Original Creditor - 'Bank Of America'
Memo - 'This is memo line 1. @@@
                    This is memo line 2. 22222
                     This is memo line 3. *!~*!~'

User fields, Document Variables and Report Variables with the Characteristics Type of Character are also String Variables.

String Variable expressions will need single quotes around Literal values. (fixed/actual value, not variable value)

For Example: Status='010'

Alphabetic string values order based on abc order and capitalization. Capitalized characters are greater than non-capitalized characters.

For Example: 'abc'<'ABC' You might recognize this behavior in the sorting of Simple DEX templates or Check sorting. The names in All Caps come before the names in all lower case.


Note: For this reason, you should always force all string variables to uppercase before any expression compare.

Numeric string values order based on each character left to right.

For Example: '1', '10', '13', '2', '209', '21', '3'


Note: For this reason, you must be very careful when using the < or > signs on numeric strings as it may think 209 is smaller that 3.

Also, when evaluating an condition expression for a string variable, the process compares one character at a time starting from left to right.

For Example: Status '010'<>'10'     On a claims whose status is 010, the condition expression Status='10' would be false because the comparison of characters left to right does not match exactly although we know 010 =10 numerically.

For Example: 'ABC'<'ABCD'

String Values can be added only. However, adding two string values together only combines both character lists.

For Example: 'ABC'+ 'Z12' = 'ABCZ12'

  Numeric Variables

There are two basic types of Numeric Variables used in Condition Statements: Integer and Float.

An Integer is a whole number. A whole number has no decimal or decimal (fraction) places.

For Example: 1000 or 222 or 15001

A Float is a number that can have decimal places such as currency or percentages.

For Example: 1500.15 or .20 or 7.09

Numeric and String Variables cannot be added/subtracted, however Integers and Floats Variables can be.

For Example: You cannot add DebtNum + 1 to get the next debtor number. You would have to convert DebtNum to an Integer before adding to it. You can add DBal + 5.

Numeric Variable expressions do not need quotes around literal values (fixed/actual value).

User Fields, Document Variables, and Report Variables with Characteristics Types of Numeric are Numeric Variables.

     Date/Time Variables

Date and Time Variables return the current date and time. Dates are serial dates that return a numeric value representing the number of days since 12/31/1899.

For Example: 4/14/2011 = 40447

This allows you to add and subtract from the current date.

  Expression Basics:

Each expression in a condition statement is made up of different parts. There are functions, variables, operators and values.

For Example: StrToInt(Status)<500

StrToInt = Function
Status = Variable
< = Operator
500 = Literal Value

In each expression there can be multiple Functions and Multiple Values depending on the Function. Also, for each condition there can be multiple expressions.

For Example:
Copy(Uppercase(County),1,3)='HEN' and POS(Status, '010;011;012;015')>0 and DBALI>=2500

  Functions:

The Condition Editor will be changed to list the String Routines and Date/Time Routines as Functions. The following functions will be removed from the Editor:

These functions will still be available for use if needed however they will not be displayed because the likelihood of them being used in a condition function is very unlikely.

Remember these functions are for Condition Statements only.

The following Functions will still be listed in the Condition Editor:

  IntToStr() - Integer to String:

Converts a Integer Variable to a String Variable.

For Example: IntToStr(UVABC)>'2'

In this example, we are converting a numeric user field into a string value to compare against a Literal String Value. However, comparing a string to a string can produce unexpected results because of how strings order. So, this example is not recommended and this function will be rarely used in a condition statement.

  StrToInt() - String to Integer:

Converts a String Variable to a Integer Variable.

For Example: StrToInt(Status)>=10

In this example, we are converting Status, a string variable, to an integer so we can compare it to 10. This allows for a straight comparison to a number. So, a claim with a status of 010 would be consider equal to 10 and therefore make this a true expression.

  FloatToStr() - Float to String

Converts a Floating point value Variable to a String Variable.

For Example: FloatToStr(DBALI)>'1000.50'

In this example, we are converting a DBALI, a float variable, to a string to compare it with the string 1000.50. As with IntToStr this example is not recommend because of the ordering issues with string variables. Most likely this function will be used when comparing an existing float variable such as DBALI to a user field that should have been coded as a numeric but again ordering issues may make this a problem.

  StrToFloat() - String to Float

Converts a String Value into a Numeric Float Variable.

For Example: StrToFloat(UVXYZ)>1499.99

In this example, we are converting a user field that has a characteristics type of character to a float variable to compare it will the numeric value of 1499.99. This will most often be used to convert incorrectly formatted user fields.

  Copy(,) - Copy

Allows you to copy out or extract parts of a string variable for comparison to a string value. Copy requires the variable followed by comma, the starting character for the copy (X), a comma and the number of characters to copy (Y); Copy(Variable, X,Y)

For Example: Copy(County, 1, 3)='HEN'

In this example, we are comparing/copying the characters starting at the first character until the third character of the county to the string HEN. Because we are comparing a string, we need to remember that uppercase letters are greater than lowercase letters therefore it is recommended that all alphabetic strings be forced to uppercase before comparison using the uppercase function.

  Pos(,) - Position

Allows you to compare a single value to a list of string values to determine if the value is present in the list of values in the expression. This function returns a 0 or greater number representing it's location in the list of string values in the express.

For Example: POS(Status, '100;101;102;103;104')=0

In this example, we are checking the claim status, a string variable to see if it is present in the list of string values in the expression. If the status codes for the claim is found then the POS value will be a non zero so the expression will not be true since we are looking for a claim that does not have one of the listed status codes. The POS function can be used instead of a long list of condition expressions of Status<>'100' and Status<>'101' and Status<>'102' and ....

  Length() - Length

Allows you to get the length of a string value.

For Example: Length(CONAME)>0

In this example, we are checking the Co-debtor's name to see if the length is greater that 0. If the length is greater than zero then we know there is a Co-debtor attached to the claim. You can also do CONAME>''.

  Trim() - Trim

Trims the spaces and line feeds from the left and right of a variable value. It will not remove spaces from the middle from the a variable value.

For Example: Trim(DebtNum)>'20100001'

In this example, we are trimming the leading spaces from the account number, a string variable to compare it to a Literal String Value. This can be used to trim a user field that users have added spaces in the value.

  TrimLeft() - Left Trim

Trims spaces and line feeds from the left of a variable value.

For Example: TrimLeft(DebtNum)>'1'

In this example, we are trimming the left spaces of the account number, a string variable, to compare it to a Literal String Value of 1. This can be used to trim a user field that the users have added spaces before the value.

  TrimRight() - Right Trim

Trims spaces and line feeds from the right of a variable value. CollectMax automatically removes the right spaces from a variable but not line fees. Use this variable to remove line feed from a variable.

  Uppercase - Uppercase

Forces a string value to uppercase. The uppercase function is recommended for use when comparing any strings unless a user can guarantee that the data is already in uppercase or that the data's case has been entered correctly 100% of the time.

For Example: Uppercase(Court)='RICHMOND GENERAL DISTRICT COURT'

In this example we are forcing the court to all upper case and comparing it to a string value that is also in all uppercase to find the claims with a primary court that equals the Literal Value.

  Date() - Date

Is today's Serial Date.

For Example: Date()-7>LastPayDt

In this example, we are taking todays date minus 7 days and comparing it to the last payment date.

  DateToStr() - Date to String

Converts a Date to a String in MM/DD/YYYY format.

For Example: Copy(DateToStr(DOPENDT),7,4)='2011'

In this example, we are converting the Open date to a string and copying the last four and comparing it to the Literal Value of 2011. DateToStr will be most used in conjunction with the Copy Function to copy parts of the date.

  StrtoDate - String to Date

Converts string variable to a date variable.

For Example: StrToDate(UVXDate)=StrToDate('4/14/2011')

In this example, we convert a character type user field to a date and compare it to the Literal Date of 4/14/2011. This function will be used mostly to convert user fields with incorrect types to dates for comparison to a date value.

  DayofWeek() - Day of the Week

Returns the Day of the Week based on a Date Variable. The function will return a value of 1 - 7 with 1 being Sunday.

For Example: DayofWeek(LACTDATE)=4

In this example, we are taking the last action date determining which day of the week and comparing it to Wednesday/Day 4.